/**
 * 品牌接口
 */

 const Controller = require('egg').Controller

 class BrandController extends Controller {
    // 查询
    async list() {
        const { ctx } = this;
        ctx.body = await ctx.service.admin.brand.list(ctx.request.body);
    }

    // 详情
    async details() {
        const { ctx } = this;
        ctx.body = await ctx.service.admin.brand.details(ctx.request.body);
    }

    //  (新增/编辑)
    async add_redact() {
        const { ctx } = this
        if(ctx.request.body.id) {
            ctx.body = await ctx.service.admin.brand.redact(ctx.request.body)
        }else{
            ctx.body = await ctx.service.admin.brand.add(ctx.request.body)
        }
    }

    // 删除
    async del() {
        const { ctx } = this;
        ctx.body = await ctx.service.admin.brand.del(ctx.request.body);
    }
 }

 module.exports = BrandController